package com.itheima;

import cn.hutool.captcha.CaptchaUtil;
import cn.hutool.captcha.LineCaptcha;
import cn.hutool.captcha.ShearCaptcha;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.itheima.service.IEmployeeService;
import com.itheima.service.IUserService;
import com.itheima.ship.po.Employee;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import java.util.List;

/**
 * @Author itzt
 * @Date 2024/5/18 11:58
 * @Version 1.0
 */
@SpringBootTest
public class test {
    @Autowired
    private IEmployeeService employeeService;
    @Autowired
    private IUserService userService;
    public static void main(String[] args) {
        // 定义图形验证码的长和宽
        LineCaptcha lineCaptcha = CaptchaUtil.createLineCaptcha(100, 100);
// 图形验证码写出，可以写出到文件，也可以写出到流
        String code = lineCaptcha.getCode();

        lineCaptcha.write("D:\\test\\a.jpg");
    }

@Test
    void page(){
        int pageNo = 1, pageSize = 5;
    Page<Employee> page = Page.of(pageNo, pageSize);
    page.addOrder(new OrderItem("update_time", false));
    Page<Employee> page1 = employeeService.page(page);
    List<Employee> records = page1.getRecords();
    records.forEach(System.out::println);

  }
}
